home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / librw / RWHashDictionary.z / RWHashDictionary
Encoding:
Text File  |  1998-10-30  |  18.6 KB  |  397 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))                                  RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWHashDictionary - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               typedef RWHashDictionary Dictionary;  // Smalltalk typedef.
  13.  
  14.  
  15.  
  16.               #include <rw/hashdict.h>
  17.           RWHashDictionary  a ;
  18.  
  19.  
  20.  
  21.  
  22. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  23.      An RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy represents a group of unordered values, accessible by
  24.      external keys.  Duplicate keys are not allowed. RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy is
  25.      implemented as a hash table of associations of keys and values.  Both the
  26.      key and the value must inherit from the abstract base class
  27.      RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee, with a suitable definition of the virtual function hhhhaaaasssshhhh(((())))
  28.      and iiiissssEEEEqqqquuuuaaaallll(((()))) for the key.  TTTThhhhiiiissss ccccllllaaaassssssss ccccoooorrrrrrrreeeessssppppoooonnnnddddssss ttttoooo tttthhhheeee SSSSmmmmaaaallllllllttttaaaallllkkkk ccccllllaaaassssssss
  29.      DDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy....
  30.  
  31. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  32.      None
  33.  
  34. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  35.               RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy(size_t n = RWDEFAULT_CAPACITY);
  36.  
  37.  
  38.      Construct an empty hashed dictionary using nnnn hashing buckets.
  39.  
  40.               RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy(const RWHashDictionary& hd);
  41.  
  42.  
  43.      Copy constructor.  A shallow copy of the collection hhhhdddd is made.
  44.  
  45. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss
  46.               void
  47.           ooooppppeeeerrrraaaattttoooorrrr====(const RWHashDictionary& hd);
  48.  
  49.  
  50.      Assignment operator.  A shallow copy of the collection hhhhdddd is made.
  51.  
  52.               RWBoolean
  53.           ooooppppeeeerrrraaaattttoooorrrr<<<<====(const RWHashDictionary& hd) const;
  54.  
  55.  
  56.      Returns TTTTRRRRUUUUEEEE if for every key-value pair in self, there is a
  57.      corresponding key in hhhhdddd that iiiissssEEEEqqqquuuuaaaallll.  Their corresponding values must
  58.      also be equal. NNNNooootttteeee:  If you inherit from RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy in the
  59.      presence of the Standard C++ Library, we recommend that you override this
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))                                  RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.      operator and explicitly forward the call.  Overload resolution in C++
  75.      will choose the Standard Library provided global operators over inherited
  76.      class members.  These global definitions are not appropriate for set-like
  77.      partial orderings.
  78.  
  79.               RWBoolean
  80.           ooooppppeeeerrrraaaattttoooorrrr========(const RWHashDictionary& hd) const;
  81.  
  82.  
  83.      Returns TTTTRRRRUUUUEEEE if self and hhhhdddd have the same number of entries and if for
  84.      every key-value pair in self, there is a corresponding key in hhhhdddd that
  85.      iiiissssEEEEqqqquuuuaaaallll.  Their corresponding values must also be equal.
  86.  
  87. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  88.               void
  89.           aaaappppppppllllyyyyTTTTooooKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(RWapplyKeyAndValue ap, void* x);
  90.  
  91.  
  92.      Applies the user-supplied function pointed to by aaaapppp to each key-value
  93.      pair of the collection.  Items are not visited in any particular order.
  94.      An untyped argument may be passed to the aaaapppp function through xxxx.
  95.  
  96.               RWBinaryTree
  97.           aaaassssBBBBiiiinnnnaaaarrrryyyyTTTTrrrreeeeeeee();
  98.           RWBag
  99.           aaaassssBBBBaaaagggg() const;
  100.           RWSet
  101.           aaaassssOOOOrrrrddddeeeerrrreeeeddddCCCCoooolllllllleeeeccccttttiiiioooonnnn() const;
  102.           aaaassssSSSSeeeetttt() const;
  103.           RWOrdered
  104.           RWBinaryTree
  105.           aaaassssSSSSoooorrrrtttteeeeddddCCCCoooolllllllleeeeccccttttiiiioooonnnn() const;
  106.  
  107.  
  108.      Converts the RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy to an RRRRWWWWBBBBaaaagggg, RRRRWWWWSSSSeeeetttt, RRRRWWWWOOOOrrrrddddeeeerrrreeeedddd, or an
  109.      RRRRWWWWBBBBiiiinnnnaaaarrrryyyyTTTTrrrreeeeeeee.  Note that since a dictionary contains pairs of keys and
  110.      values, the result of this call will be a container holding
  111.      RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeeeAAAAssssssssoooocccciiiiaaaattttiiiioooonnnnssss.  Note also that the return value is a ccccooooppppyyyy of
  112.      the data. This can be very expensive for large collections.  Consider
  113.      using ooooppppeeeerrrraaaattttoooorrrr++++====(((()))) to insert each RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeeeAAAAssssssssoooocccciiiiaaaattttiiiioooonnnn from this
  114.      dictionary into a collection of your choice.
  115.  
  116.               virtual RWspace
  117.           bbbbiiiinnnnaaaarrrryyyySSSSttttoooorrrreeeeSSSSiiiizzzzeeee() const;
  118.  
  119.  
  120.      Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.
  121.  
  122.               virtual void
  123.           cccclllleeeeaaaarrrr();
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))                                  RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.  Removes all key-value pairs in the
  141.      collection.
  142.  
  143.               virtual void
  144.           cccclllleeeeaaaarrrrAAAAnnnnddddDDDDeeeessssttttrrrrooooyyyy();
  145.  
  146.  
  147.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.  Removes all key-value pairs in the
  148.      collection, and deletes the key aaaannnndddd the value.
  149.  
  150.               virtual int
  151.           ccccoooommmmppppaaaarrrreeeeTTTToooo(const RWCollectable* a) const;
  152.  
  153.  
  154.      Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee.
  155.  
  156.               virtual RWBoolean
  157.           ccccoooonnnnttttaaaaiiiinnnnssss(const RWCollectable* target) const;
  158.  
  159.  
  160.      Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.
  161.  
  162.               virtual size_t
  163.           eeeennnnttttrrrriiiieeeessss() const;
  164.  
  165.  
  166.      Inherited from class RRRRWWWWSSSSeeeetttt.
  167.  
  168.               virtual RWCollectable*
  169.           ffffiiiinnnndddd(const RWCollectable* target) const;
  170.  
  171.  
  172.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.  Returns the kkkkeeeeyyyy which iiiissssEEEEqqqquuuuaaaallll to the
  173.      object pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found.
  174.  
  175.               RWCollectable*
  176.           ffffiiiinnnnddddKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target,
  177.                RWCollectable*& v) const;
  178.  
  179.  
  180.      Returns the key which iiiissssEEEEqqqquuuuaaaallll to the item pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if
  181.      no key was found.  The value is put in vvvv.  You are responsible for
  182.      defining vvvv before calling this function.
  183.  
  184.               RWCollectable*
  185.           ffffiiiinnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target) const;
  186.  
  187.  
  188.      Returns the vvvvaaaalllluuuueeee associated with the key which iiiissssEEEEqqqquuuuaaaallll to the item
  189.      pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found.
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))                                  RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))
  203.  
  204.  
  205.  
  206.               RWCollectable*
  207.           ffffiiiinnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target,
  208.           RWCollectable* newValue);
  209.  
  210.  
  211.      Returns the vvvvaaaalllluuuueeee associated with the key which iiiissssEEEEqqqquuuuaaaallll to the item
  212.      pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found.  Replaces the value
  213.      with nnnneeeewwwwVVVVaaaalllluuuueeee (if a key was found).
  214.  
  215.               virtual unsigned
  216.           hhhhaaaasssshhhh() const;
  217.  
  218.  
  219.      Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee.
  220.  
  221.               RWCollectable*
  222.           iiiinnnnsssseeeerrrrttttKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(RWCollectable* key,RWCollectable* value);
  223.  
  224.  
  225.      Adds a key-value pair to the collection and returns the key if
  226.      successful, nnnniiiillll if the key is already in the collection.
  227.  
  228.               virtual RWClassID
  229.           iiiissssAAAA() const;
  230.  
  231.  
  232.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee to return ________RRRRWWWWHHHHAAAASSSSHHHHDDDDIIIICCCCTTTTIIIIOOOONNNNAAAARRRRYYYY.
  233.  
  234.               virtual RWBoolean
  235.           iiiissssEEEEmmmmppppttttyyyy() const;
  236.  
  237.  
  238.      Inherited from class RRRRWWWWSSSSeeeetttt.
  239.  
  240.               virtual RWBoolean
  241.           iiiissssEEEEqqqquuuuaaaallll(const RWCollectable* a) const;
  242.  
  243.  
  244.      Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee.
  245.  
  246.               virtual size_t
  247.           ooooccccccccuuuurrrrrrrreeeennnncccceeeessssOOOOffff(const RWCollectable* target) const;
  248.  
  249.  
  250.      Inherited from class RRRRWWWWSSSSeeeetttt.  Returns the number of keys which iiiissssEEEEqqqquuuuaaaallll to
  251.      the item pointed to by ttttaaaarrrrggggeeeetttt.  Because duplicates are not allowed, this
  252.      function can only return 0 or 1.
  253.  
  254.               virtual RWCollectable*
  255.           rrrreeeemmmmoooovvvveeee(const RWCollectable* target);
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))                                  RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))
  269.  
  270.  
  271.  
  272.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.  Removes the key and value pair where
  273.      the key iiiissssEEEEqqqquuuuaaaallll to the item pointed to by ttttaaaarrrrggggeeeetttt.  Returns the key, or
  274.      nnnniiiillll if no match was found.
  275.  
  276.               virtual void
  277.           rrrreeeemmmmoooovvvveeeeAAAAnnnnddddDDDDeeeessssttttrrrrooooyyyy(const RWCollectable* target);
  278.  
  279.  
  280.      Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.  Removes aaaannnndddd deletes the key and value
  281.      pair where the key iiiissssEEEEqqqquuuuaaaallll to the item pointed to by ttttaaaarrrrggggeeeetttt.  Note that
  282.      both the key and the value are deleted.  Does nothing if the key is not
  283.      found.
  284.  
  285.               RWCollectable*
  286.           rrrreeeemmmmoooovvvveeeeKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target,
  287.                RWCollectable*& v);
  288.  
  289.  
  290.      Removes the key and value pair where the key iiiissssEEEEqqqquuuuaaaallll to the item pointed
  291.      to by ttttaaaarrrrggggeeeetttt.  Returns the key, or nnnniiiillll if no match was found.  The value
  292.      part of the removed pair is put in vvvv.  You are responsible for defining vvvv
  293.      before calling this function.
  294.  
  295.               void
  296.           rrrreeeessssiiiizzzzeeee(size_t n = 0);
  297.  
  298.  
  299.      Inherited from class RRRRWWWWSSSSeeeetttt.
  300.  
  301.               virtual void
  302.           rrrreeeessssttttoooorrrreeeeGGGGuuuuttttssss(RWvistream&);
  303.           virtual void
  304.           rrrreeeessssttttoooorrrreeeeGGGGuuuuttttssss(RWFile&);
  305.           virtual void
  306.           ssssaaaavvvveeeeGGGGuuuuttttssss(RWvostream&) const;
  307.           virtual void
  308.           ssssaaaavvvveeeeGGGGuuuuttttssss(RWFile&) const;
  309.  
  310.  
  311.      Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.
  312.  
  313.               virtual RWCollection*
  314.           sssseeeelllleeeecccctttt(RWtestCollectable testfunc, void* x) const;
  315.  
  316.  
  317.      Evaluates the function pointed to by ttttsssstttt for the key of each item in the
  318.      RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy.  It inserts keys and values for which the function
  319.      returns TTTTRRRRUUUUEEEE into a new RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy allocated off the heap and
  320.      returns a pointer to this new collection.  Because the new dictionary is
  321.      allocated ooooffffffff tttthhhheeee hhhheeeeaaaapppp, you are responsible for deleting it when done.
  322.      This is a vvvviiiirrrrttttuuuuaaaallll function which hides the non-virtual function inherited
  323.      from RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))                                  RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++))))
  335.  
  336.  
  337.  
  338.               virtual RWCollection*
  339.           sssseeeelllleeeecccctttt(RWtestCollectablePair testfunc, void* x) const;
  340.  
  341.  
  342.      Evaluates the function pointed to by ttttsssstttt for both the key and the value
  343.      of each item in the RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy.  It inserts keys and values for
  344.      which the function returns TTTTRRRRUUUUEEEE into a new RRRRWWWWHHHHaaaasssshhhhDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy allocated off
  345.      the heap and returns a pointer to this new collection.  Because the new
  346.      dictionary is allocated ooooffffffff tttthhhheeee hhhheeeeaaaapppp, you are responsible for deleting it
  347.      when done.  This is a vvvviiiirrrrttttuuuuaaaallll function which hides the non-virtual
  348.      function inherited from RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn.
  349.  
  350.               RWStringID
  351.           ssssttttrrrriiiinnnnggggIIIIDDDD();
  352.  
  353.  
  354.      (acts virtual) Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee.
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.